<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">


<link rel="stylesheet" type="text/css"
	href="../js/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../js/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="../js/easyui/demo/demo.css">
<script type="text/javascript" src="../js/easyui/jquery.min.js"></script>
<script type="text/javascript" src="../js/easyui/jquery.easyui.min.js"></script>
</head>
<body>

<script type="text/javascript">

    $(document).ready(function () { 
/* 	   $(function() { */
    	 var p = $('#dg').datagrid('getPager');  
    	                $(p).pagination({  
    		            async : true, //异步   
    	                pageSize: 10,//每页显示的记录条数，默认为5  
    	                pageList: [10, 20 ,30],//可以设置每页记录条数的列表  
    	                beforePageText: '第',//页数文本框前显示的汉字  
    	                afterPageText: '页    共 {pages} 页',  
    	                displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录'
    	            });  
    	
    	}); 
    	
   
    	
    	  $(document).ready(function () { 
     		$('#smt').bind('click', function(){  
     		
     			
     	
     			var name = document.getElementById("name").value;
     			var sex = document.getElementById("sex").value;
     			var cardType = document.getElementById("cardType").value;
     			var cardid = document.getElementById("cardid").value;
     			var type = document.getElementById("passengerType").value;
     			
     			$("#dg").datagrid({
     			    toolbar: '#toolbar',
     			    url: '../adminQueryServlet?name='+name+"&sex="+sex+"&cardType="+cardType+"&cardid="+cardid+"&type="+type,
     			    method: 'post',     			   
     			    height: '500px',
     			    singleSelect: true,
     			    fitColumns: true,
     			    pagination: true,
     			    rownumbers: true,
     			    loadMsg: "正在加载数据...",
     			    columns: [[
     			        { field: 'id', title: '序号', width: 30 },
     			        { field: 'name', title: '用户名', width: 30 },
     			        { field: 'password', title: '密码', width: 30 },
     			        { field: 'rname', title: '真实姓名', width: 30 },
     			        { field: 'cardType', title: '证件类型', width: 30 },
     			       	{ field: 'card', title: '证件号码', width: 30 },
     			      	{ field: 'sex', title: '性别', width: 30 },
     			     	{ field: 'type', title: '旅客类型', width: 30 },
     			    	{ field: 'content', title: '备注', width: 30 }
     			        ]]	
    		});   
    	       
     		});
  
		
   		}); 
    	
    	

        function removeUser(){  
            var row=$('#dg').datagrid('getSelected');  
            if(row){  
                $.messager.confirm("系统提示","您确定要删除这条记录吗?",function(r){  
                    if(r){  
                        $.post('../AdminDeleteServlet',{delId:row.id},function(result){  
                            if(result.success){  
                                $.messager.alert("系统提示","已成功删除这条记录!");  
                                $("#dg").datagrid("reload");  
                            }else{  
                                $.messager.alert("系统提示",result.errorMsg);  
                            }  
                        },'json');  
                    }  
                });  
            }  
        }  
    	  	
</script>
	<div id="nav"><form id="form1" action="../adminQueryServlet" >
			用户名：<input type="text"  id="name" name="name">
			性别：<select name="sex" id="sex">
					<option>男</option>
					<option>女</option>
				</select>
		证件类型：<select class="text_cray" name="cardType" id="cardType">
            <option>二代身份证</option>
            <option>港澳通行证 </option>
            <option>台湾通行证</option>
            <option> 护照</option>
          </select>
			证件号码：<input type="text" id="cardid" name="cardid">
			旅客类型：  <select class="text_cray" id="passengerType" name="type" style="width:100px">
            <option >成人</option>
            <option >儿童</option>
            <option >学生</option>
            <option >残疾军人、伤残人民警察</option>
          </select>
			<!-- <input type="submit" id="smt" value="查询" onclick="chaxun()"  ></input>  -->
		 <input type="button" id="smt" value="查询" >
		</form></div>
		<div id="toolbar">
		<a
			href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true"
			onclick="removeUser()">删除</a>
		</div>
		<table id="dg" title="用户管理" class="easyui-datagrid"
		style="width: 1041px; height: 430px" url="../AdminQServlet"
		toolbar="#toolbar"  rownumbers="true" pagination="true"  pageSize=10
		fitColumns="true" singleSelect="true">
		<thead>
			<tr>
				<th field="id" width="30">序号</th>
				<th field="name" width="30">用户名</th>
				<th field="password" width="20">密码</th>
				<th field="rname" width="50">真实姓名</th>
				<th field="cardType" width="50">证件类型</th>
				<th field="card" width="50">证件号码</th>
				<th field="sex" width="50">性别</th>
				<th field="province" width="50">省份</th>
				<th field="city" width="50">城市</th>
				<th field="type" width="50">旅客类型</th>
				<th field="content" width="50">备注</th>
				<th field="status" width="50">权限</th>	
			</tr>
		</thead>
	</table>
</body>
</html>